package com.yanqu.road.server.cmd.activity.curio;

import com.google.protobuf.InvalidProtocolBufferException;
import com.yanqu.road.pb.cangbao.CurioProto;
import com.yanqu.road.pb.syncMessage.SyncMessage;
import com.yanqu.road.server.game.service.IGameServiceCommand;
import com.yanqu.road.server.manger.activity.curio.CurioMgr;
import com.yanqu.road.sync.message.SyncResponse;

public class CurioWatchItemServiceCmd implements IGameServiceCommand {

    @Override
    public SyncResponse execute(SyncMessage.Request request) throws InvalidProtocolBufferException {
        SyncResponse syncResponse = new SyncResponse();
        CurioProto.CurioWatchPlayerItemReqMsg reqMsg = CurioProto.CurioWatchPlayerItemReqMsg.parseFrom(request.getDataBytes());
        CurioProto.CurioWatchPlayerItemRespMsg.Builder builder = CurioMgr.watchItem(reqMsg.getUserId(), reqMsg.getItemId());
        syncResponse.setResponseBuilder(builder);
        return syncResponse;
    }
}
